<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>SearchPage</title>
    <link rel="StyleSheet" href="../../css/mypetstore.css" type="text/css" media="screen"/>
</head>
<body>
<div th:replace="jsp/common/top"></div>
<div id="Content">

    <div id="BackLink">
        <a href="/catalog/view">Return to Main Menu</a>
    </div>

    <div id="Catalog">

        <table>
            <tr>
                <th>&nbsp;</th>
                <th>Product ID</th>
                <th>Name</th>
            </tr>
            <tr th:each="product : ${productList}">
                <td>
                    <a th:href="@{/catalog/viewProduct(productId=${product.getProductid()})}" name="productId"
                       th:value="${product.getProductid()}">
                        <div th:with="desc=${product.getDescn()}">
                            <span th:utext="${#strings.substringBefore(desc, '&lt;')}"></span>
                            <img th:src="${'../../'+desc.replaceFirst('.*src=&quot;([^&quot;]+)&quot;.*', '$1')}"
                                 th:alt="${desc.replaceFirst('.*src=&quot;[^&quot;]+&quot;(.*)', '$1')}">
                            <span th:utext="${#strings.substringAfter(desc, '&gt;')}"></span>
                        </div>
                    </a>
                </td>

                <td>
                    <b>
                        <a th:href="@{/catalog/viewProduct(productId=${product.getProductid()})}" name="productId"
                           th:value="${product.getProductid()}">
                            <font color="BLACK" th:text="${product.getProductid()}"></font>
                        </a>
                    </b>
                </td>
                <td th:text="${product.getName()}"></td>
            </tr>
            <!--    <c:forEach var="product" items="${sessionScope.productList}">-->
            <!--      <tr>-->
            <!--        <td>-->
            <!--          <a href="productForm?productId=${product.productId}" name="productId" value="${product.productId}">${product.description}</a>-->
            <!--        </td>-->
            <!--        <td><b>-->
            <!--          <a href="productForm?productId=${product.productId}" name="productId" value="${product.productId}">-->
            <!--            <font color="BLACK"> ${product.productId} </font>-->
            <!--          </a>-->
            <!--        </b></td>-->
            <!--        <td>${product.name}</td>-->
            <!--      </tr>-->
            <!--    </c:forEach>-->
            <tr>
                <td></td>
            </tr>

        </table>

    </div>
</div>
<div th:replace="jsp/common/bottom"></div>
</body>
</html>